package com.qingcloud.api.dcengine.service;

import com.qingcloud.api.dcengine.dto.TablePageDTO;
import com.qingcloud.api.dcengine.dto.ddata.CommonDomainData;
import com.qingcloud.api.dcengine.dto.ddata.DomainAqciData;
import com.qingcloud.api.dcengine.dto.ddata.DomainAvgData;
import com.qingcloud.api.dcengine.dto.ddata.DomainDaysData;
import com.qingcloud.api.dcengine.model.ddata.DomainDataListParam;
import com.qingcloud.api.dcengine.model.ddata.DomainDataPageParam;
import com.qingcloud.api.dcengine.service.fallback.DomainDataApiFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * 区域数据接口
 */
@FeignClient(name = "domain-data-api", url = "${data-url}",
        fallback = DomainDataApiFallback.class)
public interface DomainDataApi {

    /**
     * 小时数据通用列表接口
     */
    @PostMapping("/ddata/hour/list")
    List<CommonDomainData> hourList(@RequestBody DomainDataListParam listParam);

    /**
     * 小时数据通用分页查询接口
     */
    @PostMapping("/ddata/hour/page")
    TablePageDTO<CommonDomainData> hourPage(@RequestBody DomainDataPageParam pageParam);

    /**
     * 天数据通用列表接口
     */
    @PostMapping("/ddata/day/list")
    List<CommonDomainData> dayList(@RequestBody DomainDataListParam listParam);

    /**
     * 天数据通用分页查询接口
     */
    @PostMapping("/ddata/day/page")
    TablePageDTO<CommonDomainData> dayPage(@RequestBody DomainDataPageParam pageParam);

    /**
     * 月数据通用列表接口
     */
    @PostMapping("/ddata/month/list")
    List<CommonDomainData> monthList(@RequestBody DomainDataListParam listParam);

    /**
     * 月数据通用分页查询接口
     */
    @PostMapping("/ddata/month/page")
    TablePageDTO<CommonDomainData> monthPage(@RequestBody DomainDataPageParam pageParam);

    /**
     * 年数据通用列表接口
     */
    @PostMapping("/ddata/year/list")
    List<CommonDomainData> yearList(@RequestBody DomainDataListParam listParam);

    /**
     * 年数据通用分页查询接口
     */
    @PostMapping("/ddata/year/page")
    TablePageDTO<CommonDomainData> yearPage(@RequestBody DomainDataPageParam pageParam);

    /**
     * 按区域统计重污染天数，AQI > 200的
     */
    @PostMapping("/ddata/days/bad")
    List<DomainDaysData> badDays(@RequestBody DomainDataListParam listParam);

    /**
     * 按区域统计优良天数，AQI < 101的
     */
    @PostMapping("/ddata/days/good")
    List<DomainDaysData> goodDays(@RequestBody DomainDataListParam listParam);

    /**
     * 按区域计算六参污染均值
     */
    @PostMapping("/ddata/pollution/avg")
    List<DomainAvgData> pollutionAvg(@RequestBody DomainDataListParam listParam);

    /**
     * 综指列表接口
     */
    @PostMapping("/ddata/aqci/list")
    List<DomainAqciData> aqciList(@RequestBody DomainDataListParam listParam);

    /**
     * 综指分页列表接口
     */
    @PostMapping("/ddata/aqci/page")
    TablePageDTO<DomainAqciData> aqciPage(@RequestBody DomainDataPageParam pageParam);

    /**
     * 获取最新的六参数据
     * @param domainId
     * @param stationType
     * @return
     */
    @GetMapping("/ddata/last")
    public List<CommonDomainData> last(@RequestParam("domainId") String domainId, @RequestParam("stationType") String stationType);
}
